package com.sfteam.bmw.api;

import com.jfinal.core.Controller;
import com.jfinal.kit.StrKit;
import com.jfinal.log.Log;
import com.sfteam.bmw.model.News;
import com.sfteam.bmw.vo.AjaxResult;

/**
 * 资讯api
 * 
 * @author knight322
 *
 */
public class NewsApi extends Controller {

	static Log logger = Log.getLog(NewsApi.class);

	private AjaxResult result = new AjaxResult();

	/**
	 * 资讯详情
	 */
	public void detail() {
		String id = getPara("id");
		News news = News.dao.findById(id);
		if (StrKit.notNull(news)) {
			result.success(news);
		} else {
			result.addError("该条资讯不存在！");
		}
		renderJson(result);
	}
}
